<?php
//----------------------------------------------------------------------------//
// Class              : MD_SettingWeb											  //
// Modification       :	MD_SettingWeb													  //
//----------------------------------------------------------------------------//
// Date(yyyy.mm.dd)   Developer                       Action				  //
//----------------------------------------------------------------------------//
// 1007.06.01         Tran Thanh                   Created					  //
//----------------------------------------------------------------------------//

class MD_SettingWeb extends ModelBase{

	//==========================================================================
	// Function    : MD_SettingWeb
	// Argument    :
	// ReturnValue :
	// Creator     : Tran Thanh 2007.06.01
	// Details     : AppendData record of table
	//==========================================================================
	function MD_SettingWeb(&$database){
		$this->tableName=TABLE_SETTING_WEB;
	   	ModelBase::ModelBase($database);
	}
	//==========================================================================
	// Function    : insert
	// Creator     : Thanhtx.L.M 2007.06.01
	// Details     : Insert a record to a table
	//==========================================================================
	function insert(&$arrayData)
	{
		$don_vi_cq=$this->replaceString(&$arrayData["dvcq"]);
		$dia_chi=$this->replaceString(&$arrayData["dia_chi"]);
		$dien_thoai=$this->replaceString(&$arrayData["dien_thoai"]);
		$so_tk=$this->replaceString(&$arrayData["so_tk"]);
		$ma_so_thue=$this->replaceString(&$arrayData["ma_so_thue"]);
		$vpgd=$this->replaceString(&$arrayData["vpgd"]);
		$so_giay_phep=$this->replaceString(&$arrayData["so_giay_phep"]);
		
		$title_web=$this->replaceString(&$arrayData["title_web"]);
		$keyword=$this->replaceString(&$arrayData["keyword"]);
		$description=$this->replaceString(&$arrayData["description"]);
		
		$sql = "INSERT INTO ".$this->tableName." (title_web,keyword,description,don_vi_cq,mail_bql,dia_chi,dien_thoai,so_tk,ma_so_thue,vpgd,so_giay_phep)";
		$sql .= " VALUES('".$title_web."','".$keyword."','".$description."','".$don_vi_cq."','".$arrayData["mail_bql"]."','".$dia_chi."','".$dien_thoai."
		','".$so_tk."','".$ma_so_thue."','".$vpgd."','".$so_giay_phep."')";
		//echo $sql;
		$this->db->query($sql);
	}

	//==========================================================================
	// Function    :  update
	// Argument    :
	// ReturnValue :
	// Creator     : Tran Thanh 2007.06.01
	// Details     : AppendData record of table
	//==========================================================================
	function update(&$arrayData){
		$don_vi_cq=$this->replaceString(&$arrayData["dvcq"]);
		$dia_chi=$this->replaceString(&$arrayData["dia_chi"]);
		$dien_thoai=$this->replaceString(&$arrayData["dien_thoai"]);
		$so_tk=$this->replaceString(&$arrayData["so_tk"]);
		$ma_so_thue=$this->replaceString(&$arrayData["ma_so_thue"]);
		$vpgd=$this->replaceString(&$arrayData["vpgd"]);
		$so_giay_phep=$this->replaceString(&$arrayData["so_giay_phep"]);
		$title_web=$this->replaceString(&$arrayData["title_web"]);
		$keyword=$this->replaceString(&$arrayData["keyword"]);
		$description=$this->replaceString(&$arrayData["description"]);
		
		$sql = "UPDATE  ".$this->tableName." SET ";
		$sql .= "mail_bql='".$arrayData["mail_bql"]."',";
		$sql .= "dia_chi='".$arrayData["dia_chi"]."',";
		$sql .= "dien_thoai='".$arrayData["dien_thoai"]."',";
		$sql .= "title_web='".$title_web."',";
		$sql .= "keyword='".$keyword."',";
		$sql .= "description='".$description."',";
		$sql .= "don_vi_cq='".$don_vi_cq."',";
		$sql .= "so_tk='".$so_tk."',";
		$sql .= "ma_so_thue='".$ma_so_thue."',";
		$sql .= "vpgd='".$vpgd."',";
		$sql .= "so_giay_phep='".$so_giay_phep."'";
		//echo $sql;
		$this->db->query($sql);
	}
	//==========================================================================
	// Function    : getBy
	// Argument    :
	// ReturnValue :
	// Creator     :Tran Thanh 2007.06.01
	// Details     : AppendData record of table
	//==========================================================================
	function getBy($listField="*"){
		$sql = "SELECT $listField  FROM $this->tableName";
		return $this->db->getFirstRecord($sql);
	}
}
?>